<?php



namespace App\Zesow;

use EasyWeChat\Factory;
use App\Services\Base\Services\ConfigService;
use App\Services\Base\Interfaces\ConfigServiceInterface;

class WechatMini
{
    private static $instance = null;

    private function __construct()
    {
    }

    /**
     * @return \EasyWeChat\MiniProgram\Application|null
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public static function getInstance()
    {
        if (!self::$instance) {
            /**
             * @var ConfigService $configService
             */
            $configService = app()->make(ConfigServiceInterface::class);

            self::$instance = Factory::miniProgram([
                'app_id' => 'wx15189f73ac6ca690',
                'secret' => '4c0100a7a80cf4cfbdf1caa13e160603',
                'oauth' => [
                    'scopes'   => ['snsapi_userinfo'],
                    'callback' => '/oauth_callback',
                ],
            ]);
        }

        return self::$instance;
    }
}
